using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Management.Core.Models.Mapping
{
    public class AdminMap : EntityTypeConfiguration<Admin>
    {
        public AdminMap()
        {
            // Primary Key
            this.HasKey(t => t.AdminID);

            // Properties
            this.Property(t => t.Accounts)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.Password)
                .IsRequired()
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("Admins");
            this.Property(t => t.AdminID).HasColumnName("AdminID");
            this.Property(t => t.Accounts).HasColumnName("Accounts");
            this.Property(t => t.Password).HasColumnName("Password");
            this.Property(t => t.LoginIP).HasColumnName("LoginIP");
            this.Property(t => t.LoginTime).HasColumnName("LoginTime");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
        }
    }
}
